package club.adger.system.config;

import org.mybatis.spring.annotation.MapperScan;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.cloud.netflix.eureka.EnableEurekaClient;
import org.springframework.context.annotation.ComponentScan;
import org.springframework.core.env.Environment;

/**
 * Created with IntelliJ IDEA.
 *
 * @Auther: Adger
 * @Date: 2020/07/22/19:38
 * @EnableEurekaClient 作为注册中心客户端
 */
@SpringBootApplication
@EnableEurekaClient
@ComponentScan("club.adger")
@MapperScan("club.adger.server.mapper")
public class SystemApplication {
    /**
     * 注意这里导入的是slf4j的日志包
     */
    private static final Logger LOG = LoggerFactory.getLogger(SystemApplication.class);

    /**
     * 优化后的启动函数
     * LOG.info() 打印日志信息
     * LOG.info("Eureka地址: \thttp://127.0.0.1:{}", env.getProperty("server.port"));
     * 上面这行代码的 env.getProperty("server.port") 取得端口号
     * @param args
     */
    public static void main(String[] args) {
        SpringApplication app = new SpringApplication(SystemApplication.class);
        Environment env = app.run(args).getEnvironment();
        LOG.info("启动成功！！");
        // 注意修改 地址前面的模块名字
        LOG.info("System地址: \thttp://127.0.0.1:{}", env.getProperty("server.port"));
    }
}
